Skip to content

fix MLXLogger - #493

Merged
davidkoski merged 4 commits into
mainfrom
fix-491
Sep 30, 2026
Merged

davidkoski merged 4 commits into
mainfrom
fix-491

Conversation

@davidkoski

Copy link
Copy Markdown
Member

Proposed changes

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

- fix #491
- OSLog.Logger.isEnabled(type:) is not actually available since macOS 11 (and friends)
- this causes crashes on iOS/macOS before 26.4
- use different API
#import <os/log.h>
#import <stdbool.h>

static inline bool is_os_log_enabled(os_log_t log, os_log_type_t type) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OSLog.Logger.isEnabled(type:) was added in 26.4 but availability claims macOS 11. At the same time os_log_type_enabled was made unavailable from swift. We have to workaround this in C to make something callable.

@nwh nwh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@davidkoski
davidkoski merged commit 1960120 into main Sep 30, 2026
7 checks passed
@davidkoski
davidkoski deleted the fix-491 branch September 30, 2026 18:18
spokvulcan pushed a commit to spokvulcan/mlx-swift that referenced this pull request Oct 3, 2026
* fix MLXLogger

- fix ml-explore#491
- OSLog.Logger.isEnabled(type:) is not actually available since macOS 11 (and friends)
- this causes crashes on iOS/macOS before 26.4
- use different API

(cherry picked from commit 1960120)

Backport note: the xcode/MLX.xcodeproj hunk is left out (it conflicts with
this branch's project file and SwiftPM does not read it).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] 0.32.2 causes iOS app to crash at launch on a physical iPhone running iOS 26.2

2 participants